package com.wrx.club_management_backend.utils;

import cn.hutool.core.bean.BeanUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
public  class RedisWorker {

    @Autowired
    static StringRedisTemplate stringRedisTemplate;

    public static void saveCacheForHash(Object o, String key){
        Map<String, Object> map = BeanUtil.beanToMap(o);
        stringRedisTemplate.opsForHash().putAll(
                key,
                map
                );
    }

}
